package com.principle.singleresponsibility;

/**
 * @author mxs
 * 单一职责原则举例2
 */
public class Responsibility2 {
    public static void main(String[] args) {
        CarVehicle carVehicle = new CarVehicle();
        carVehicle.run("car");
        PlaneVehicle planeVehicle = new PlaneVehicle();
        planeVehicle.run("plane");
    }
}

/**
 * 给每一重交通工具创建一个类
 */
class CarVehicle {
    public void run(String vehicle) {
        System.out.println(vehicle + " can run");
    }
}

class PlaneVehicle {
    public void run(String vehicle) {
        System.out.println(vehicle + " can fly");
    }
}
